﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DTcms.Common;

namespace DTcms.Web.admin.shiming
{
    public partial class shiming_edit : Web.UI.ManagePage
    {
        public List<string> smo = new List<string>();
        private string action = DTEnums.ActionEnum.Add.ToString(); //操作类型
        private int id = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            string _action = DTRequest.GetQueryString("action");
            this.id = DTRequest.GetQueryInt("id");

           
                this.action = DTEnums.ActionEnum.Edit.ToString();//修改类型
                if (this.id == 0)
                {
                    JscriptMsg("传输参数不正确！", "back");
                    return;
                }
                if (!new BLL.shiming().Exists(this.id))
                {
                    JscriptMsg("内容不存在或已被删除！", "back");
                    return;
                }
          
            if (!Page.IsPostBack)
            {
                this.id = DTRequest.GetQueryInt("id");
                ShowInfo(this.id);
                
            }
        }

        #region 赋值操作=================================
        private void ShowInfo(int _id)
        {
            BLL.shiming bll = new BLL.shiming();
            Model.shiming model = bll.GetModel(_id);
            smo.Add(model.real_name);
            smo.Add((model.type_id == 1 ? "个人认证" : "企业认证"));
           
            smo.Add(model.shenfenzheng_num);
            smo.Add(model.zhizhao_num);
            smo.Add(model.mobile);
            smo.Add(model.company_name);
            smo.Add(GetshimingstatusText(model.status+""));
            string imgurl = "";
            if (model.albums.Count > 0) {
                foreach (var a in model.albums) {
                    imgurl += "<a href='"+a.original_path+"' target='_blank'><img src='"+a.original_path+"' style=height:200px;></a>";
                }
            }
            smo.Add(imgurl);
          
        }
        #endregion

        public string GetshimingstatusText(string _status)
        {
            string flag = "";
            if (_status == "1") { flag = "<font color='#ff0000'>待审核</font>"; }
            else if (_status == "2") { flag = "<font color='#080808'>已退回</font>"; }
            else if (_status == "99") { flag = "<font color='#7CCD7C'>已审核</font>"; }
            return flag;
        }
       
    }
}